﻿using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Turquoise.Business;
using Turquoise.Business.Abstract;
using Turquoise.Caching.Aspects.CastleWindsor;
using Turquoise.Logging.Aspects.CastleWindsor;
using Turquoise.Web.Common.Abstract;
using Turquoise.Web.Common.Security;

namespace Turquoise.Web.Management.Infrastructure.CastleInstallers
{
    public class ServiceInstaller : IWindsorInstaller
    {
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                Component.For<ILanguageService>().ImplementedBy<LanguageManager>().Interceptors(
                    typeof(CacheInterceptor),
                    typeof(LogInterceptor)
                    ).LifestyleTransient(),
                Component.For<ISettingService>().ImplementedBy<SettingManager>().LifestyleTransient(),
                Component.For<IContentTypeService>().ImplementedBy<ContentTypeManager>().LifestyleTransient(),
                Component.For<ISessionService>().ImplementedBy<SessionManager>().LifestyleTransient(),
                Component.For<IUserService>().ImplementedBy<UserManager>().LifestyleTransient(),
                Component.For<IEmailService>().ImplementedBy<EmailManager>().LifestyleTransient(),
                Component.For<IWebSecurityManager>().ImplementedBy<WebSecurityManager>().LifestyleTransient()
                );
        }
    }
}